########################################################################
# build.sh - XXPROGNAMEXX build script
# Copyright (C) 2013 XXAUTHORNAMEXX <XXAUTHOREMAILXX>
#
# These comments cannot be remove or edited and should remain intact
# because this file comments is an extension to the GPL3 license.
# This software file is covered by GPL version 3 license.
# Please see the LICENSE and gpl3.txt or gpl3.htm in doc directory
# for the license agreement, if its not exist, write to the 
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
# Modification below this line is allowed
########################################################################
# Extra credits to:
#
########################################################################
# Notes:
# 
########################################################################
echo ----------------------------------- [ XXPROGNAMEXX build ]
echo Building XXPROGNAMEXX ...
source ./XXPROGNAMEXX.prj
if [ -z "$PROJECTEXEC" ]
then
	echo Cannot find XXPROGNAMEXX.prj, change directory to project dir and run again.
	echo Current dir is `pwd`
	exit 0
fi
MKDIR="mkdir -p "
CP="cp --update --recursive "
RM="rm --force --recursive  "
CHMOD="chmod +x "
PROJECTMP=$HOME/.config/XXPROGNAMEXX/tmp/

	$RM $PROJECTMP/*.*
	$MKDIR $PROJECTMP
	echo "XXPROGNAMEXX ready" > $PROJECTMP/error
	echo "XXPROGNAMEXX ready" > $PROJECTMP/warning
	echo "XXPROGNAMEXX ready" > $PROJECTMP/question
	echo "XXPROGNAMEXX ready" > $PROJECTMP/info
	echo "XXPROGNAMEXX ready" > $PROJECTMP/authentication
	echo "Type here what you want, use it as a notice/scratch board" > $PROJECTMP/notepad.txt
	echo "#!/bin/bash" > $PROJECTMP/script.sh
	echo "<span color=\"Navy\" font-family=\"Sans\" size=\"large\"><i>XXAUTHORNAMEXX</i></span>" > $PROJECTMP/textpad.txt

	export PROJECTBUILD=$PROJECTBASEPATH
	$MKDIR $PROJECTBUILD/bin
	$MKDIR $PROJECTBUILD/dlg
	$MKDIR $PROJECTBUILD/data
	$MKDIR $PROJECTBUILD/dist
	$MKDIR $PROJECTBUILD/doc
	$MKDIR $PROJECTBUILD/lib
	$MKDIR $PROJECTBUILD/locale
	$MKDIR $PROJECTBUILD/pix
	$CP $PROJECTBASEPATH/src/bin/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/xml $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/dlg/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/data/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/dist/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/doc/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/lib/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/locale/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/pix/ $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/remove.sh $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/setup.sh $PROJECTBUILD
	$CP $PROJECTBASEPATH/src/XXPROGNAMEXX $PROJECTBUILD
	$CHMOD $PROJECTBUILD/remove.sh
	$CHMOD $PROJECTBUILD/setup.sh
	$CHMOD $PROJECTBUILD/XXPROGNAMEXX
	echo gtk-apply " | "`date +%X` "| XXPROGNAMEXX build complete| XXPROGNAMEXX build script" > $PROJECTMP/log
	echo Your project now ready for distribution in [ $PROJECTBUILD ]
	echo Now we test install and run on this system - executing XXPROGNAMEXX
	cd $PROJECTBUILD
	./setup.sh
